package b.a.a;

import a.e.b.a.*;
import a.e.b.b.t;
import a.e.b.c.eb;
import a.e.b.c.o;
import a.e.b.c.v;
import a.j.ld;
import b.a.d.d;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.net.MalformedURLException;
import java.net.URL;

public class a
  extends i
{
  private static final b_ c = new b_(null);
  static Class j;
  static Class k;
  static Class l;
  public static int m;
  
  public String a()
  {
    return "SVGNode";
  }
  
  public String b()
  {
    return "http://www.yworks.com/xml/graphml";
  }
  
  public Class d()
  {
    if (!b.k) {}
    return j == null ? (a.j = b("b.a.d.b")) : j;
  }
  
  public void a(ld paramld, a.e.b.c.cb paramcb, o paramo)
    throws a.e.b.c.a
  {
    super.a(paramld, paramcb, paramo);
    b.a.d.b localb = (b.a.d.b)paramld;
    d locald = localb.g();
    paramcb.a("SVGModel", "http://www.yworks.com/xml/graphml");
    if (!b.k)
    {
      if (locald != null) {
        a(locald, paramcb, paramo);
      }
      paramcb.b();
    }
  }
  
  private void a(d paramd, a.e.b.c.cb paramcb, o paramo)
  {
    boolean bool = b.k;
    if ((paramo == null) || (paramd == null)) {
      return;
    }
    paramcb.c("svgBoundsPolicy", String.valueOf(paramd.e()));
    if (!bool) {}
    kb localkb = (kb)paramo.a(k == null ? (a.k = b("a.e.b.a.kb")) : k);
    ib localib = null;
    StringWriter localStringWriter = new StringWriter();
    String str = null;
    try
    {
      paramd.a(localStringWriter);
      str = localStringWriter.toString();
    }
    catch (IOException localIOException) {}
    if ((localkb != null) && (str != null)) {
      localib = localkb.a(str, c);
    }
    paramcb.a("SVGContent", "http://www.yworks.com/xml/graphml");
    if (!bool)
    {
      if (localib != null) {
        paramcb.c("refid", localib.b());
      }
    }
    else {
      if (!bool) {
        break label222;
      }
    }
    if (str != null)
    {
      paramcb.c(str.replaceAll("\r\n", "\n"));
      if (!bool) {}
    }
    else
    {
      URL localURL = paramd.b();
      if (bool) {
        return;
      }
      if (localURL != null) {
        paramcb.c("href", localURL.toString());
      }
    }
    label222:
    paramcb.b();
  }
  
  public void a(ld paramld, Node paramNode, t paramt)
    throws a.e.b.b.a
  {
    boolean bool = b.k;
    b.a.d.b localb = (b.a.d.b)paramld;
    super.a(localb, paramNode, paramt);
    NodeList localNodeList = paramNode.getChildNodes();
    if (localNodeList != null)
    {
      int i = 0;
      do
      {
        if (i >= localNodeList.getLength()) {
          break;
        }
        Node localNode1 = localNodeList.item(i);
        if (!bool)
        {
          if (localNode1.getNodeType() == 1)
          {
            String str = localNode1.getLocalName();
            if (bool) {
              continue;
            }
            if (("SVGModel".equals(str)) && ("http://www.yworks.com/xml/graphml".equals(localNode1.getNamespaceURI())))
            {
              a(localb, localNode1, paramt);
              Node localNode2 = localNode1.getAttributes().getNamedItem("svgBoundsPolicy");
              if (bool) {
                continue;
              }
              if (localNode2 != null) {
                localb.g().b(Integer.parseInt(localNode2.getNodeValue()));
              }
            }
          }
          i++;
        }
      } while (!bool);
    }
  }
  
  private void a(b.a.d.b paramb, Node paramNode, t paramt)
    throws a.e.b.b.a
  {
    boolean bool = b.k;
    if (!bool) {
      if (paramt == null) {
        return;
      }
    }
    if (!bool) {}
    jb localjb = (jb)paramt.a(l == null ? (a.l = b("a.e.b.a.jb")) : l);
    NodeList localNodeList = paramNode.getChildNodes();
    int i = 0;
    label259:
    label407:
    do
    {
      if (i >= localNodeList.getLength()) {
        break;
      }
      Node localNode1 = localNodeList.item(i);
      if (!bool)
      {
        if ((localNode1.getNodeType() == 1) && ((bool) || (("SVGContent".equals(localNode1.getLocalName())) && ("http://www.yworks.com/xml/graphml".equals(localNode1.getNamespaceURI())))))
        {
          d locald = null;
          NamedNodeMap localNamedNodeMap = localNode1.getAttributes();
          Node localNode2 = localNamedNodeMap.getNamedItem("refid");
          if (!bool) {
            if ((localNode2 != null) && ((bool) || (localjb != null)))
            {
              locald = (d)localjb.a(localNode2.getNodeValue(), c, null, paramt);
              break label259;
            }
          }
          Node localNode3 = localNode1.getFirstChild();
          if ((bool) || (localNode3.getNodeType() == 3))
          {
            String str = localNode3.getNodeValue();
            locald = new d(new StringReader(str));
          }
          if (locald != null)
          {
            paramb.a((d)locald.clone());
            if (!bool) {}
          }
          else
          {
            localNode2 = localNamedNodeMap.getNamedItem("href");
            if (bool) {
              continue;
            }
            if (localNode2 != null) {
              try
              {
                paramb.a(new URL(localNode2.getNodeValue()));
              }
              catch (MalformedURLException localMalformedURLException)
              {
                if (!bool)
                {
                  if (y.a(paramt, "y.io.graphml.input.DeserializationProperties.IGNORE_RESOURCE_ERRORS")) {
                    a.i.n.a("Cannot load SVG from: " + localNode2.getNodeValue());
                  }
                }
                else {
                  if (!bool) {
                    break label407;
                  }
                }
                throw new a.e.b.b.a("Cannot load SVG from: " + localNode2.getNodeValue(), localMalformedURLException);
              }
            }
          }
        }
        i++;
      }
    } while (!bool);
  }
  
  static Class b(String paramString)
  {
    try
    {
      return Class.forName(paramString);
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new NoClassDefFoundError().initCause(localClassNotFoundException);
    }
  }
  
  private static class b_
    implements a.e.b.b.n, v
  {
    private b_() {}
    
    public Object a(Node paramNode, t paramt)
    {
      boolean bool = b.k;
      d locald = null;
      if (((bool) || (paramNode != null)) && ((bool) || (paramNode.getNodeType() == 3)))
      {
        String str = paramNode.getNodeValue();
        locald = new d(new StringReader(str));
      }
      return locald;
    }
    
    public void a(a.e.b.b.cb paramcb)
      throws a.e.b.b.a
    {
      Node localNode = paramcb.e();
      if (((b.k) || (localNode != null)) && (localNode.getNodeType() == 3)) {
        paramcb.a(a(localNode, paramcb.d()));
      }
    }
    
    public void a(Object paramObject, a.e.b.c.cb paramcb, o paramo)
    {
      String str = (String)paramObject;
      paramcb.c(str.replaceAll("\r\n", "\n"));
    }
    
    public void a(eb parameb)
      throws a.e.b.c.a
    {
      Object localObject = parameb.a();
      if (!b.k)
      {
        if ((localObject instanceof String)) {
          a(localObject, parameb.e(), parameb.d());
        }
      }
      else {
        parameb.a(true);
      }
    }
    
    b_(a.0 param0)
    {
      this();
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     b.a.a.a

 * JD-Core Version:    0.7.0.1

 */